<?php

/**
 * @file node.tpl.php
 *
 * Theme implementation to display a node.
 *
 * Available variables:
 * - $title: the (sanitized) title of the node.
 * - $content: Node body or teaser depending on $teaser flag.
 * - $picture: The authors picture of the node output from
 *   theme_user_picture().
 * - $date: Formatted creation date (use $created to reformat with
 *   format_date()).
 * - $links: Themed links like "Read more", "Add new comment", etc. output
 *   from theme_links().
 * - $name: Themed username of node author output from theme_username().
 * - $node_url: Direct url of the current node.
 * - $terms: the themed list of taxonomy term links output from theme_links().
 * - $submitted: themed submission information output from
 *   theme_node_submitted().
 *
 * Other variables:
 * - $node: Full node object. Contains data that may not be safe.
 * - $type: Node type, i.e. story, page, blog, etc.
 * - $comment_count: Number of comments attached to the node.
 * - $uid: User ID of the node author.
 * - $created: Time the node was published formatted in Unix timestamp.
 * - $zebra: Outputs either "even" or "odd". Useful for zebra striping in
 *   teaser listings.
 * - $id: Position of the node. Increments each time it's output.
 *
 * Node status variables:
 * - $teaser: Flag for the teaser state.
 * - $page: Flag for the full page state.
 * - $promote: Flag for front page promotion state.
 * - $sticky: Flags for sticky post setting.
 * - $status: Flag for published status.
 * - $comment: State of comment settings for the node.
 * - $readmore: Flags true if the teaser content of the node cannot hold the
 *   main body content.
 * - $is_front: Flags true when presented in the front page.
 * - $logged_in: Flags true when the current user is a logged-in member.
 * - $is_admin: Flags true when the current user is an administrator.
 *
 * @see template_preprocess()
 * @see template_preprocess_node()
 */
?>
<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?> clear-block">

<?php if (!$page): ?>
  <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>
<!--start content-->
<div id="node-left-picture">
  <div class="field field-type-filefield field-field-product-images">
    <!-- <span class="field-label">图片</span>  -->
    <div class="field-items">
        <?php print $node->field_product_images[0]['view'] ?>
    </div>
  </div>
</div>
<div id="node-right-detail">
  <div class="field field-type-text field-node-title">
    <div class="product-title"><?php print $node->title;?></div>
  </div>
  <div class="field field-type-text field-field-product-sub-title">
    <div class="field-items">
      <?php print $node->field_product_sub_title[0]['view'] ?>
    </div>
  </div>
  <div class="field field-type-text field-field-product-type">
    <div class="field-items">
       <?php 
        $types = best_get_terms_byvid($node->taxonomy, PRODUCT_TYPE_VID); 
        if (count($types)) {
          print "<span class='field-label'>产品分类：</span>";
          foreach($types as $key => $val) {
            print l($val->name, "list/$key");
            print " ";
          }
        }
       ?>
    </div>
  </div>

 <div class="field field-type-text field-field-product-brand">
    <div class="field-items">
       <?php 
        $types = best_get_terms_byvid($node->taxonomy, PRODUCT_BRAND_VID); 
        if (count($types)) {
          print "<span class='field-label'>品牌：</span>";
          foreach($types as $key => $val) {
            print l($val->name, "list/$key");
            print " ";
          }
        }
       ?>
    </div>
  </div>

  <div class="field field-type-text field-field-product-no">
    <div class="field-items">
      <span class="field-label">编号：</span>
      <?php print $node->field_product_no[0]['view'] ?>
    </div>
  </div>

  <div class="field field-type-text field-field-product-type">
    <div class="field-items">
      <span class="field-label">型号：</span>
      <?php print $node->field_product_type[0]['view'] ?>
    </div>
  </div>

  <div class="field field-type-number-float field-field-product-price-market">
    <div class="field-items">
      <span class="field-label">市场价：</span>
      <?php print $node->field_product_price_market[0]['view'] ?>
    </div>
  </div>
  
  <div class="field field-type-text field-field-product-no">
    <div class="field-items">
      <span class="field-label">批发价：</span>
      <?php print $node->field_product_price_wholesale[0]['view'] ?>
    </div>
  </div>

  <?php if ($page) { ?>
  <div class="field node-add-cart">
    <?php
    //NEED check if user_access('use simple cart')
    print theme('add_to_cart_link', $node);
    ?>
  </div>
  <div class="clear"></div>
  <?php } ?>
</div>
<div class="clear"></div>
<div id="node-body">
  <span class="filed-node-body">商品描述：</span>
  <div id="node-body-content">
   <?php print($node->content['body']['#value']); ?>
  </div>
</div>
<!--end content -->
</div>
